<?php
echo $javascript->link(array('tab','ckeditor/ckeditor','ckeditor/adapters/jquery'));
echo $this->Html->css(array('tab'));

?>

<h2>Templates</h2>   
<table id="table" width="1030px" cellpSaveing="5" cellspacing="5">
    <tr align="center">
        <td>In this section you can edit the templates of the automatic emails sent to users.</br>
            In some of them the {tags} used to personalize the emails and include order detais</br>
            Please be careful, do not delete {tags} from templates or not to loose them!
        </td>
    </tr>
</table>

            <div id="mainMenu">
<a >Verification email</a>
<a >Registration</a>
<a >Facebook Registration</a>
<a >Forgotten Password</a>
<a >Reactivate Account</a>
<a >Membership plan expires<br>(sent a week before the account will expire) </a>
<a >Membership plan expires </a>
<a>Account Deactivated</a>
</div>
            <div id="submenu">
	<!-- The first sub menu -->
        <?php $i='1'; foreach ($Templates as $template): ?>
	<div id="submenu_<?php echo $i; ?>" >
	   <?php echo $this->Form->Create('Template',array('controller'=>'Template','action'=>'admin_edit'));
                 echo $this->Form->input('id',array('type'=>'hidden','label'=>'','value'=>$template['Template']['id']));
           ?>
                <table cellpSaveing="10" cellspacing="10" align="center" width="700px">
                    
                    <tr>
                        <td id="label" >Title</td>
                        <td><?php echo $this->Form->input('Template.title', array('label' => '','value'=>$template['Template']['title'])); ?></td>
                    </tr>                
                    <tr>
                        <td id="label"  >Description</td>
                        <td><?php echo $this->Form->input('Template.desc', array('label' => '','value'=>$template['Template']['desc'],'cols'=>'80','rows'=>'40','id'=>$i)); ?></td>
                    </tr>                
                    <tr><td></td><td></td></tr>
                
                </table>
                <?php echo $this->Form->end('Save'); ?>
      
	</div>
        <?php $i++;
endforeach;
        ?>
	
</div>
    <script language="javascript">
    $(document).ready(function(){
        var i=0;
       $.each('textarea',function(){
           $( '#'+i ).ckeditor();
           i++;
       });
       
        
    });

</script>